package com.example.a.simplay1;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Button;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button button1 = (Button) findViewById(R.id.start);
        button1.setOnClickListener(startIt);
        Button button2 = (Button) findViewById(R.id.stop);
        button2.setOnClickListener(stopIt);
    }
    private OnClickListener startIt = new OnClickListener() {
        public void onClick(View v) {
            startService(new Intent("com.studio.android.START_AUDIO_SERVICE"));
        }
    };
    private OnClickListener stopIt = new OnClickListener() {
        public void onClick(View v) {
            stopService(new Intent("com.studio.android.START_AUDIO_SERVICE"));
            finish();
        }
    };
}
